<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    
    <head>
        <meta charset="utf-8">
        <meta property="qc:admins" content="01676642316411516375" />
        <meta name="keywords" content="fly,layui,前端社区">
        <meta name="description" content="Fly社区是跨设备模块化前端框架layui的官网社区，致力于为web开发提供强劲动力">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <title>
            <?php echo $title ?> - <?php echo C('STIE_NAME') ?>
        </title>
        <!-- <link rel="stylesheet" href="//at.alicdn.com/t/font_24081_wqs7mbp4zl8wu3di.css"> -->
        <!-- <link rel="stylesheet" href="//res.layui.com/layui/build/css/layui.css?t=1503225931801">
        <link rel="stylesheet" href="//res.layui.com/css/fly/global.css?t=1503225931801"
        charset="utf-8"> -->
        <!-- <link rel="stylesheet" data-href="//res.layui.com/css/fly/stretch.css?t=1503225931801"
        class="fly-style"> -->
        <!-- 从Public目录开始找 -->
        <link rel="stylesheet" href="/yuephp/bbs1n/Public/css/font_24081_wqs7mbp4zl8wu3di.css">
        <link rel="stylesheet" href="/yuephp/bbs1n/Public/layui/css/layui.css">
        <link rel="stylesheet" href="/yuephp/bbs1n/Public/css/global.css">
        <script src="/yuephp/bbs1n/Public/layui/layui.js">
        </script>
        
    </head>
    
    <body>
        <div class="header">
            <div class="main">
                <a class="logo" href="/yuephp/bbs1n" title="Fly">
                    Fly社区
                </a>
                <div class="nav">
                    <a href="/jie/">
                        <i class="iconfont icon-wenda">
                        </i>
                        讨论
                    </a>
                    <a href="/case/2017/">
                        <i class="iconfont icon-iconmingxinganli" style="top: 2px;">
                        </i>
                        案例
                    </a>
                    <a href="http://www.layui.com/">
                        <i class="iconfont icon-ui">
                        </i>
                        框架
                    </a>
                </div>

            <?php if (isset($_SESSION['id'])) { ?>

                <div class="nav-user">
                    <a class="avatar" href="<?php echo U('home/set/index');?>"><!-- Public/images/168.jpg -->
                        <img src="/yuephp/bbs1n/<?php echo $_SESSION['face'] ?>">
                        <cite>
                            <?php echo $_SESSION['nickname'] ?>
                        </cite>
                    </a>
                    <div class="nav">
                        <a href="<?php echo U('home/set/index');?>">
                            <i class="iconfont icon-shezhi">
                            </i>
                            设置
                        </a>
                        <a href="<?php echo U('home/login/outLogin');?>">
                            <i class="iconfont icon-tuichu" style="top: 0; font-size: 22px;">
                            </i>
                            退了
                        </a>
                    </div>
                </div>

            <?php } else { ?>

                <div class="nav-user">
                    <a class="unlogin" href="/user/login/">
                        <i class="iconfont icon-touxiang">
                        </i>
                    </a>
                    <span>
                        <a href="<?php echo U('home/login/index');?>">
                            登入
                        </a>
                        <a href="<?php echo U('home/reg/index');?>">
                            注册
                        </a>
                    </span>
                    <p class="out-login">
                        <a href="http://fly.layui.com/app/qq" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})"
                        class="iconfont icon-qq" title="QQ登入">
                        </a>
                        <a href="http://fly.layui.com/app/weibo/" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})"
                        class="iconfont icon-weibo" title="微博登入">
                        </a>
                    </p>
                </div>

            <?php } ?> 
                

                

            </div>
        </div>

    <div class="main layui-clear">
    <div class="wrap">
        <div class="content detail">
            <div class="fly-panel detail-box">
                <h1>
                    <?php echo $card['title'] ?>
                </h1>
                <div class="fly-detail-info">
                    <!-- <span class="fly-badge fly-badge-stick">
                        置顶帖
                    </span> -->
                    <span class="fly-badge">
                        <?php echo $card['status'] ?>
                    </span>
                    <div class="fly-admin-box" data-id="14853">
                    </div>
                    <span class="fly-list-nums">
                        <a href="#comment">
                            <i class="iconfont" title="回答">
                                
                            </i>
                            <?php echo $card['answer_num'] ?>
                        </a>
                        <i class="iconfont" title="人气">
                            
                        </i>
                        <?php echo $card['view_num'] ?>
                    </span>
                </div>
                <div class="detail-about">
                    <a class="fly-avatar" href="<?php echo U('home/U/index',array('id'=>$card['uid'] ));?>">
                        <img src="/yuephp/bbs1n/<?php echo $card['face'] ?>" alt="<?php echo $card['nickname'] ?>">
                    </a>
                    <div class="fly-detail-user">
                        <a href="<?php echo U('home/U/index',array('id'=>$card['uid'] ));?>" class="fly-link">
                            <cite>
                                <?php echo $card['nickname'] ?>
                            </cite>
                            <i class="iconfont icon-renzheng" title="认证信息：官方人员">
                            </i>
                        </a>
                        <span>
                            <?php echo CT($card['create_time']) ?>
                        </span>
                    </div>
                    <div class="detail-hits" id="LAY_jieAdmin" data-id="14853">
                        <span style="padding-right: 10px; color: #FF7200">
                            悬赏：<?php echo $card['kiss_num'] ?>飞吻
                        </span>

                        

                        <?php if (isset($_SESSION['id'])) { ?>
                            <!-- 把当前收藏人的id赋给uid,当前点击收藏的帖子id->$card['id']赋给qid  异步抓取到并POST -->
                            <!-- 判断该帖子的id->$card['id'] 是否 在用户收藏 帖子的id集合里->$storeQids -->
                            <?php if (in_array($card['id'], $storeQids)) { ?>
                                <span class="layui-btn layui-btn-mini jie-admin layui-btn-danger store" type="collect" data-type="remove" qid="<?php echo $card['id'] ?>" uid="<?php echo $_SESSION['id'] ?>" >取消收藏</span>        
                            <?php }else{ ?>                            
                                <span class="layui-btn layui-btn-mini jie-admin store" type="collect" data-type="add" qid="<?php echo $card['id'] ?>" uid="<?php echo $_SESSION['id'] ?>" >收藏</span>
                            <?php } ?>
                            
                        <?php } ?>
                        







                    </div>
                </div>
                <div class="detail-body photos">
                    <!-- <a href="https://gitee.com/sentsin/layui" target="_blank" rel="nofollow">
                        https://gitee.com/sentsin/layui
                    </a>
                    <br>
                    <img src="//cdn.layui.com/upload/2017_9/336_1505468627085_9927.jpg" layer-index="0">
                    <br>
                    <br>
                    虽然不知道有什么用，但还是感谢码云的认可
                    <br>
                    欢迎前往码云
                    <a href="https://gitee.com/sentsin/layui" target="_blank" rel="nofollow">
                        Star layui
                    </a> -->
                    <?php echo htmlspecialchars_decode($card['content']) ?>
                </div>
            </div>
            <!--<hr style="margin-bottom: 25px;">-->
            <div class="fly-panel detail-box" id="flyReply">
                <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
                    <legend>
                        回帖
                    </legend>
                </fieldset>
                <?php if (empty($answers)) { ?>
                <ul class="jieda" id="jieda">                  
                    <li class="fly-none">消灭零回复</li>                
                </ul>
                <?php }else{ ?>

                    <ul class="jieda" id="jieda">
                    <?php foreach ($answers as $row) { ?>
                        <li data-id="<?php echo $row['id'] ?>">
                            <a name="item-1505469519062">
                            </a>
                            <div class="detail-about detail-about-reply">
                                <a class="fly-avatar" href="<?php echo U('home/u/index',array('id'=>$row['uid']));?>">
                                    <img src="/yuephp/bbs1n/<?php echo $row['face'] ?>"
                                    alt="<?php echo $row['nickname'] ?>">
                                </a>
                                <div class="fly-detail-user">
                                    <a href="<?php echo U('home/u/index',array('id'=>$row['uid']));?>" class="fly-link">
                                        <cite>
                                            <?php echo $row['nickname'] ?>
                                        </cite>
                                    </a>
                                </div>
                                <div class="detail-hits">
                                    <span>
                                        <?php echo CT($row['create_time']) ?>
                                    </span>
                                </div>
                            </div>
                            <div class="detail-body jieda-body photos">
                                <?php echo htmlspecialchars_decode($row['content']) ?>
                            </div>


                            <div class="jieda-reply">

                            <?php if (in_array($row['id'], $zanAids)) { ?>
                                <span class="jieda-zan  zanok answerZan" type="zan" title="您已点过赞" answerid="<?php echo $row['id'] ?>">              
                                    <i class="iconfont icon-zan"> 
                                    </i>              
                                    <em>
                                        <?php echo $row['zan_num'] ?>
                                    </em>           
                                </span>
                            <?php }else{ ?>
                                <span class="jieda-zan answerZan" type="zan" title="您还未赞" answerid="<?php echo $row['id'] ?>">
                                    <i class="iconfont icon-zan">
                                    </i>
                                    <em>
                                        <?php echo $row['zan_num'] ?>
                                    </em>
                                </span>
                            <?php } ?>
                                
                                <!-- answerName为点击回复 时抓到[@+被回复人的名字] -->
                                <span type="reply" class="clickAnswer" answerName="<?php echo $row['nickname'] ?>">
                                    <i class="iconfont icon-svgmoban53">
                                    </i>
                                    回复
                                </span>
                            </div>


                        </li>
                    <?php } ?>
                    </ul>

                <?php } ?>
                <div class="layui-form layui-form-pane">
                    <form action="" method="post">
                        <div class="layui-form-item layui-form-text">
                            <a name="comment">
                            </a>
                            <div class="layui-input-block atext">
                                <!-- <div class="layui-unselect fly-edit">
                                    <span type="face" title="插入表情">
                                        <i class="iconfont icon-yxj-expression" style="top: 1px;">
                                        </i>
                                    </span>
                                    <span type="picture" title="插入图片：img[src]">
                                        <i class="iconfont icon-tupian">
                                        </i>
                                    </span>
                                    <span type="href" title="超链接格式：a(href)[text]">
                                        <i class="iconfont icon-lianjie">
                                        </i>
                                    </span>
                                    <span type="code" title="插入代码或引用">
                                        <i class="iconfont icon-emwdaima" style="top: 1px;">
                                        </i>
                                    </span>
                                    <span type="hr" title="插入水平线">
                                        hr
                                    </span>
                                    <span type="yulan" title="预览">
                                        <i class="iconfont icon-yulan1">
                                        </i>
                                    </span>
                                </div> -->
                                <textarea id="L_content" name="content" 
                                placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 150px;"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <!-- 隐藏回复哪个帖子的qid对应answer表  值为$card['id']当前帖子的id 异步发送处理 -->
                            <input type="hidden" name="qid" value="<?php echo $card['id'] ?>">
                            <!-- <input type="hidden" name="uid" value="<?php echo $_SESSION['id'] ?>">
                            <input type="hidden" name="daPages" value="1"> -->
                            <button class="layui-btn" lay-filter="addAnswer" lay-submit="">
                                提交回复
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="edge">
        <dl class="fly-panel fly-list-one">
            <dt class="fly-panel-title">
                近期热议
            </dt>
            <?php foreach ($hotAnswer as $row) { ?>
            <dd>
                <a href="<?php echo U('home/jie/index',array('id'=>$row['id']));?>">
                    <?php echo $row['title'] ?>
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    <?php echo $row['answer_num'] ?>
                </span>
            </dd>
            <?php } ?>
            <!-- <dd>
                <a href="/jie/14648.html">
                    layui 2.1.3 发布，进一步稳定
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    49
                </span>
            </dd>
            <dd>
                <a href="/jie/14817.html">
                    关于表格宽度百分比，请稍安勿躁
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    39
                </span>
            </dd>
            <dd>
                <a href="/jie/14636.html">
                    原有表格转换成数据表格，表头排序出错
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    36
                </span>
            </dd>
            <dd>
                <a href="/jie/14698.html">
                    layui+strtus2如何做搜索功能，下面是我写的，后台接不到数据
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    33
                </span>
            </dd>
            <dd>
                <a href="/jie/14791.html">
                    layui 2.1.4 发布，重点加强复杂表头
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    32
                </span>
            </dd>
            <dd>
                <a href="/jie/14597.html">
                    基于layUI2.0的二次前端开发页面，欢迎提出建议和修改，已附上下载源码
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    32
                </span>
            </dd>
            <dd>
                <a href="/jie/14446.html">
                    layui.table如何设置某一列隐藏
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    30
                </span>
            </dd>
            <dd>
                <a href="/jie/14486.html">
                    静态转数据表格 这个算BUG吗
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    28
                </span>
            </dd>
            <dd>
                <a href="/jie/14840.html">
                    layDate怎么通过js获取选取后的时间值，而不是通过回调获得
                </a>
                <span>
                    <i class="iconfont">
                        
                    </i>
                    26
                </span>
            </dd> -->
        </dl>
        <div class="fly-panel fly-hezuo" style="height: 166px;" time-limit="2017.07.17-2018.07.18">
            <a href="http://www.fineui.com/" target="_blank" rel="nofollow">
                <img src="/yuephp/bbs1n/Public/images/168_1500288431734_18970.jpg" style="width: 336px;">
            </a>
        </div>
        <div class="fly-panel" style="text-align: center;">
            <a href="http://layim.layui.com/?from=fly" target="_blank">
                <img src="/yuephp/bbs1n/Public/images/168_1500291753257_18702.jpg" style="width: 336px; height: 166px;"
                alt="layim下载">
            </a>
        </div>
        <div class="fly-panel" style="padding: 20px 0; text-align: center;">
            <img src="/yuephp/bbs1n/Public/images/168_1501894831075_19619.jpg" style="max-width: 100%;"
            alt="layui">
            <p style="position: relative; top: 10px; color: #666;">
                微信扫码关注 layui 公众号
            </p>
        </div>
        <a href="mailto:xu@sentsin.com">
            <div class="fly-panel fly-hezuo" style="height: 90px; background-color: #F9F9F9;"
            time-limit="">
            </div>
        </a>
    </div>
</div>
<script type="text/javascript">
    //Demo
    layui.use(['form','layer','layedit'], function(){
        $ = layui.jquery;
      var form = layui.form
      ,layer = layui.layer;
      var layedit = layui.layedit;

      //插入图片接口 [把图片放在服务器 返回图片地址]
      layedit.set({
          uploadImage: {
            url: '<?php echo U('home/jie/uploadImage');?>' //接口url处理上传图片的方法 上传成功返回JSON
            ,type: 'POST' //默认post
          }
        });
        //注意：layedit.set 一定要放在 build 前面，否则配置全局接口将无效。
      index = layedit.build('L_content', {
        height: 180 //设置编辑器高度
        }); //建立编辑器

      //自定义验证规则
    //   form.verify({
    //   content: function(value, item){ //value：表单的值、item：表单的DOM对象
    //     if (value=='') {
    //         return '问题描述不能为空!';
    //     }
    //   }
    //   //我们既支持上述函数式的方式，也支持下述数组的形式
    //   //数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]
    //   ,pass: [/(.+){6,12}$/, '密码必须6到16位!'] 
    //   ,repass: function(value){
    //     if($('#L_pass').val()!=$('#L_repass').val()){
    //         return '两次密码不一致!';
    //     }
    //   }
    //   ,verify: function(value, item){
    //     if (value=='') {
    //         return '人类验证不能为空!';
    //     }
    //   }
        
      
    // });
      
      //监听提交
      form.on('submit(addAnswer)', function(data){
        // layer.msg(JSON.stringify(data.field));
        
        //判断发布内容为空时返回提示
        content = layedit.getContent(index);
        //alert(content);
        if (content=='') {
            layer.msg('回复内容不能为空!',{icon: 5},function () {
                     // body...
                 });
            return false;
        };

        //同步内容 更改什么抓到什么
        data.field.content = content;
        $.ajax({
            url: '<?php echo U('home/jie/ajaxAddAnswer');?>',
            type: 'POST',
            dataType: 'json',
            data: data.field,
        })
        .done(function(res) {
            console.log("success");
            if (res.error==1) {
                layer.msg(res.info,function () {
                    // body...
                });
            }else{
                layer.alert("回复成功!!", {icon: 6},function () {
                    // 获得frame索引
                    //var index = parent.layer.getFrameIndex(window.name);
                    //关闭当前frame
                    //parent.layer.close(index);
                    location.reload(); //刷新
                });
            }
            

        })
        .fail(function() {
            console.log("error");
        })
        
        return false;
      });
      

      //点击收藏 or 点击取消收藏
      $('.store').click(function(event) {
          qid = $(this).attr('qid');
          uid = $(this).attr('uid');
          storeObj = $(this);

          $.ajax({
              url: '<?php echo U('home/jie/ajaxStore');?>',
              type: 'POST',
              dataType: 'json',
              data: {qid: qid, uid:uid},
          })
          .done(function(res) {
              console.log("success");
              if (res.error==1) { // 1已经收藏
                 storeObj.attr({class:"layui-btn layui-btn-mini jie-admin layui-btn-danger store"});
                 storeObj.attr('data-type',"remove");
                 storeObj.text('取消收藏');
                 layer.msg(res.info);
              }else{ //否则 0取消收藏
                 storeObj.attr({class:"layui-btn layui-btn-mini jie-admin store"});
                 storeObj.attr('data-type',"add");
                 storeObj.text('收藏');
                 layer.msg(res.info);
              }
          })
          .fail(function() {
              console.log("error");
          })

      });

        

        //点击赞 or 点击取消赞
        $('.answerZan').click(function(event) {

          answerid = $(this).attr('answerid');
          zanObj = $(this);

          $.ajax({
              url: '<?php echo U('home/jie/ajaxZan');?>',
              type: 'POST',
              dataType: 'json',
              data: {answerid:answerid},
          })
          .done(function(res) {
              console.log("success");
              if (res.error==4) { //4 未登陆 或 自己给自己点赞 
                layer.msg(res.info,function () {
                    
                });
                return false;
              };

              if (res.error==1) { // 1已赞
                 zanObj.attr({class:"jieda-zan  zanok answerZan"});
                 zanObj.children('em').text(res.zan_num); //显示最新的赞数量
                 layer.msg(res.info);
              }else{ //否则 0取消赞
                 zanObj.attr({class:"jieda-zan answerZan"});
                 zanObj.children('em').text(res.zan_num); //显示最新的赞数量
                 layer.msg(res.info);
              }
          })
          .fail(function() {
              console.log("error");
          })

      });

        //回复 的 回复 未完成 未完成 未完成
        $('.clickAnswer').click(function(event) {
            answerName = $(this).attr('answerName'); //answerName 被回复人的名字
            alert(answerName);

            a = $('#L_content').prop('outerHTML','<textarea id="L_content" name="content" placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 150px;">@'+answerName+' </textarea>');

            //a=$('.layui-layedit-iframe').prop('outerHTML','<html><head><style>*{margin: 0; padding: 0;}body{padding: 10px; line-height: 20px; overflow-x: hidden; word-wrap: break-word; font: 14px Helvetica Neue,Helvetica,PingFang SC,Microsoft YaHei,Tahoma,Arial,sans-serif; -webkit-box-sizing: border-box !important; -moz-box-sizing: border-box !important; box-sizing: border-box !important;}a{color:#01AAED; text-decoration:none;}a:hover{color:#c00}p{margin-bottom: 10px;}img{display: inline-block; border: none; vertical-align: middle;}pre{margin: 10px 0; padding: 10px; line-height: 20px; border: 1px solid #ddd; border-left-width: 6px; background-color: #F2F2F2; color: #333; font-family: Courier New; font-size: 12px;}</style></head><body contenteditable="true" style="min-height: 180px;">@'+answerName+'</body></html>');
            // a = layedit.getContent(index);
            // a ='55'+a ;

            console.log(a);
            alert(a);
            //layedit.sync(index);
            //layedit.getText(index);
            //layedit.getSelection(index);

        });

    });




</script>

        <div class="footer">
            <p>
                <a href="http://fly.layui.com/">
                    Fly社区
                </a>
                2017 &copy;
                <a href="http://www.layui.com/">
                    layui.com
                </a>
            </p>
            <p>
                <a href="http://fly.layui.com/jie/3147.html" target="_blank">
                    产品授权
                </a>
                <a href="http://fly.layui.com/jie/8157.html" target="_blank">
                    获取Fly社区模版
                </a>
                <a href="http://fly.layui.com/jie/2461.html" target="_blank">
                    微信公众号
                </a>
            </p>
        </div>
        <!--<script src="//res.layui.com/layui/build/layui.js?t=1503225931801">
        </script>!-->
        <!--<script>
            layui.cache.page = 'index';
            layui.cache.user = {
                username: '游客',
                uid: -1,
                avatar: 'http://res.layui.com/images/fly/avatar/00.jpg',
                experience: 0,
                sum: 0,
                vip: 0,
                sex: ''
            };
            layui.config({
                version: "1503225931801"
            }).extend({
                'fly': '//res.layui.com/lay/modules/fly/index'
            }).use('fly');
        </script>
        <script type="text/javascript">
            var cnzz_protocol = (("https:" == document.location.protocol) ? " https://": " http://");
            document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));
        </script>!-->
    </body>

</html>


<!-- // return array(
//     //'配置项'=>'配置值'
//     'LAYOUT_ON'=>true,
//     'LAYOUT_NAME'=>'moban',
//     'STIE_NAME'=>'Lin-社区',  //设置title的名字
//     'AUTH_PATHS'=>array(
//         'Home/Set/index',
//         'Home/Jie/add',
//         ),
// ); -->